package com.mojo.concurrent.concurrent_07_pool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 单一线程池示例
 * <pre>
 * public static ExecutorService newSingleThreadExecutor() {
 *          return new FinalizableDelegatedExecutorService
 *               (new ThreadPoolExecutor(1, 1,
 *              0L, TimeUnit.MILLISECONDS,
 *              new LinkedBlockingQueue<Runnable>()));
 * }
 * </pre>
 * 1、核心线程数等于最大线程数，只有1个Worker
 * 2、keepAliveTime时间为0L:多余空闲线程立即终止
 * 3、使用LinkedBlockingQueue无界线性阻塞队列。
 * 4、因为使用无界队列，所以运行中的线程池不会拒绝任务
 *
 * @author <a href="mailto:sjj@jianzhimao.com">mojo</a>
 * copyright (C), 2013-2023, 广州九尾信息科技有限公司
 * @date 2023/2/20 14:43
 */
public class SingleThreadPool01 {
    static ExecutorService executorService = Executors.newSingleThreadExecutor();

    public static void main(String[] args) {

    }
}
